<template>
    <div id="orderConfig">
    <el-form :label-position="labelPosition" label-width="110px" :model="formLabelAlign">
        <el-form-item label="秒杀订单超过：">
            <el-input placeholder="请输入内容" v-model="formLabelAlign.seckillTimeout">
              <template slot="append">分</template>
            </el-input>未付款，订单自动关闭
        </el-form-item>
        <el-form-item label="正常订单超过：">
             <el-input placeholder="请输入内容" v-model="formLabelAlign.orderTimeout">
              <template slot="append">分</template>
            </el-input>未付款，订单自动关闭
        </el-form-item>
        <el-form-item label="发货超过：">
             <el-input placeholder="请输入内容" v-model="formLabelAlign.takeTimeout">
              <template slot="append">天</template>
            </el-input>未收货，订单自动完成
        </el-form-item>
        <el-form-item label="订单完成超过：">
             <el-input placeholder="请输入内容" v-model="formLabelAlign.serviceTimeout">
              <template slot="append">天</template>
            </el-input>自动结束交易，不能申请售后
        </el-form-item>
         <el-form-item label="订单完成超过：">
            <el-input placeholder="请输入内容" v-model="formLabelAlign.commentTimeout">
              <template slot="append">天</template>
            </el-input>自动五星好评
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">提交</el-button>
        </el-form-item>
    </el-form>
    </div>
</template>
<script>
export default {
  data () {
    return {
      labelPosition: 'right',
      formLabelAlign: {}
    }
  },
  methods: {
    // 获取品牌信息列表
    async getfindAll () {
      // 发送请求查询数据并返回
      const { data: res } = await this.$http.get('/orders/order/config/findById/1')
      this.formLabelAlign = res.data
    },
    async onSubmit () {
      console.log(this.formLabelAlign)
      const { data: res } = await this.$http.post('/orders/order/config/update', this.formLabelAlign)
      if (res.code === 200) {
        this.$message({
          type: 'success',
          message: '修改成功'
        })
        this.getfindAll()
      }
    }
  },
  // 钩子函数
  async created () {
    this.getfindAll()
  }
}
</script>
<style>
  #orderConfig {
    width: 650px;
    display: block;
    text-align: left;
    margin:0 auto;
  }
  #orderConfig .el-input {
    width: 300px;
    padding: 0px 20px 0px 0px;
  }
  </style>
